package com.zto.sch.advance.spi;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @program: sch-diy-parent
 * @description:
 * @author: sch
 * @create: 2021-07-12 17:07
 **/
public class SpiTest {
    public static void main(String[] args) {
        ServiceLoader<Search> load = ServiceLoader.load(Search.class);
        Iterator<Search> iterator = load.iterator();
        while (iterator.hasNext()) {
            Search next = iterator.next();
            next.search("hello spi");
        }
    }
}
